import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:猜数字游戏
 * User: xwl
 * Date: 2023-03-30
 * Time: 18:30
 */
public class Test1 {
    public static void main(String[] args) {
        //创建一个[1，100)的随机数
        Scanner scan = new Scanner(System.in);
        Random random = new Random(); //1
        int randNum = random.nextInt(100); //2
        //进行循环输入，直至输入数和随机数相等
        while(true) {
            int num = scan.nextInt();
            if(randNum < num) {
                System.out.println("输入值大了");
            }else if(randNum > num) {
                System.out.println("输入值小了");
            }else if (randNum == num){
                System.out.println("恭喜你，输入正确");
                //输入正确后进行跳出
                break;
            }
        }
    }
}
